﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>欢迎登录宁夏医科大学教学岗位聘用评分信息系统</title>
    <link href="../css/style.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" href="../css/common_impt.css">

    <style>
        .loginuser{
            font-weight: normal;
        }
        .op_sub_btn{
            width: 130px;
            margin: 20px auto;
        }
        .loginbody .loginbox li label{
            margin: 0 16px 0 4px;
            padding: 0;
            position: relative;
            top: -2px;
            cursor: pointer;
        }
    </style>
</head>

<body style="background-color:#1c77ac;overflow:hidden;">
<div id="mainBody">
    <div id="cloud1" class="cloud"></div>
</div>

<div class="logintop">
    <span>欢迎登录宁夏医科大学教学岗位聘用评分信息系统</span>
</div>

<div class="loginbody">
    <div class="loginbox">
        <ul>
            <li>
                <input type="text" class="loginuser" id="userId" placeholder="工号" />
            </li>
            <li>
                <input type="password" class="loginpwd" id="pwd" placeholder="密码" />
            </li>
            <li>角色选择：
                <input name="role" type="radio" value="TEACHER" id="TEACHER"/><label for="TEACHER">教师</label>
                <input name="role" type="radio" value="RESEARCH" id="RESEARCH"/><label for="RESEARCH">教研室</label>
                <input name="role" type="radio" value="OFFICE" id="OFFICE"/><label for="OFFICE">教学办</label>
                <input name="role" type="radio" value="HR" id="HR"/><label for="HR">人事处</label>
            </li>
        </ul>
        <div class="op_sub_btn">
            <span id="loginBtn">登录</span>
        </div>
    </div>
</div>
<div class="loginbm">仅供宁夏医科大学使用，本系统版权归宁夏医科大学</div>

<script src="../js/jquery-1.12.4.js"></script>
<script src="../js/public.js"></script>

<script language="javascript">
    $(function () {
        var curRole;
        $('.loginbox').css({'position': 'absolute', 'left': ($(window).width() - 692) / 2});
        $(window).resize(function () {
            $('.loginbox').css({'position': 'absolute', 'left': ($(window).width() - 692) / 2});
        })

        $("#loginBtn").click(function () {
            var checkRole = $("input[name=role]:checked").val();
            curRole = checkRole;
            var loginParam = {
                "userId": $("#userId").val(),
                "role": checkRole,
                "password": $("#pwd").val()
            }
            for(var key in loginParam){
                if(! $.trim(loginParam[key])){
                    showTip('请将信息填写完整');
                    return;
                }
            }
            requests.postReq(urls.loginReg,JSON.stringify(loginParam),loginSucc,null);
        })

        function loginSucc(data) {
            if(data.status == 1){
                sessionStorage.setItem('userId',data.data.userId);
                sessionStorage.setItem('userName',data.data.userName);
                sessionStorage.setItem('curRole',curRole);
                if(curRole == 'TEACHER'){
                    window.location = 'tea_information.html';
                }
                if(curRole == 'RESEARCH'){
                    window.location = 'rea_audit_list.html';
                }
                if(curRole == 'OFFICE'){
                    window.location = 'off_add_works.html';
                }
                if(curRole == 'HR'){
                    window.location = 'dep_add_teacher.html';
                }

            }else{
                showTip(data.message);
            }
        }
    });
</script>
</body>
</html>
